import json
from ronglian_sms_sdk import SmsSDK

accId = '8a216da87ba59937017bf7cc51d5153c'
accToken = '86a274b7631845078c760fd13db2bebc'
appId = '8a216da87ba59937017bf7cc52b41543'


def send_message(mobile, code, time):
    sdk = SmsSDK(accId, accToken, appId)
    tid = '1'
    datas = (code, time)
    resp = sdk.sendMessage(tid, mobile, datas)
    result = json.loads(resp)
    if result['statusCode'] == '000000':
        return True
    return False


# redis连接
from django_redis import get_redis_connection


def get_redis():
    conn = get_redis_connection()
    return conn
